package xyz.yang.toodles.statemachine;

import lombok.Getter;

import java.util.List;

@Getter
public class Contract implements Process<ContractState, ContractEvent> {
    private ContractState state;
    private List<ProcessStep> processSteps;

    public Contract(ContractState state, List<ProcessStep> processSteps) {
        this.state = state;
        this.processSteps = processSteps;
    }

    @Override
    public void transfer(ContractEvent event) {
        this.state = ContractState.getTargetState(this.state, event);
    }

    @Override
    public void addProcessStep(ContractEvent event, String comment) {
        this.processSteps.add(ProcessStep.of("1", event, Operator.of("1", "张三"), comment));
    }
}
